<template>
    <div>
        <div class="title">
            <p>{{orderSource.is_used=='0'?'等待买家使用':'已完成'}}</p>
            <p>核销码: <span>{{orderSource.code}}</span> <span>已核销{{orderSource.used_num}}张 / 总计{{orderSource.num}}张</span> </p>
            <p>向商家展示正确核销码即可入店消费</p>
        </div>
        <div class="info">
            <p>
                <span>姓名：</span>
                <span>{{orderSource.username}}</span>
            </p>
            <p>
                <span>手机号码：</span>
                <span>{{orderSource.mobile}}</span>
            </p>
        </div>
        <div class="shop">
            <p>商家地址:</p>
            <p>{{orderSource.addr}}</p>
            <p>使用条件:</p>
            <p v-html="orderSource.use_desc"></p>
        </div>
        <div class="coupon">
            <img :src="orderSource.images">
            <div>
                <div style="-webkit-box-orient: vertical;"> {{orderSource.title}}</div>
                <div style="-webkit-box-orient: vertical;">
                    {{orderSource.desc}}
                </div>
                <div>
                    <div>
                        ￥{{orderSource.order_fee}}
                    </div>
                </div>
            </div>
        </div>

        <div class="order">
            <div>
                <div>订单编号：</div>
                <div>{{orderSource.order_sn}}</div>
            </div>
            <div>
                <div>下单时间：</div>
                <div>{{time(orderSource.pay_time,"yyyy.MM.dd hh:mm")}}</div>
            </div>
            <div>
                <div>商品总额：</div>
                <div>￥{{orderSource.order_fee}}</div>
            </div>
        </div>
    </div>
</template>
<script>
import { formatDate } from "../../lib/time.js";
export default {
    name: "orderCont",
    data() {
        return {
            orderSource: {},
        };
    },
    methods: {
        time(time, type) {
            let date = new Date(time);
            return formatDate(date, type);
        },
        // 方法
        orderData() {
            let params = {
                id: this.$route.query.order_id
            };
            this.$post("/member/get_coupon_detaile", params)
                .then(res => {
                    if (res.code === 20000) {
                        this.orderSource = res.data
                    }
                })
                .catch(err => { });
        },

    },
    beforeCreate() {
        document.querySelector("body").setAttribute("style", "background-color:#e1deff");
    },
    created() {
        // 实例创建完成
        this.orderData();
    },
};
</script>
<style lang="less" scoped>
@import url("../../asset/css/orderCont");
</style>